<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map_canvas { height: 100% }
</style>
<script type="text/javascript"
    src="http://maps.googleapis.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">

    var map
    var marcador
     function initialize() {
        var latlng = new google.maps.LatLng(-12.05,-76.9667 );
        var myOptions = {
          zoom: 15,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          zoomControl: true
        };
        map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);
    		
    		
        marcador = new google.maps.Marker( {
    		position: latlng,
    		map:map	
    	})
      }
    function mostrarUbicacion(){
		navigator.geolocation.getCurrentPosition( lecturaGPS , errorGPS , {enableHighAccuracy:true} )  
  }
  
  function lecturaGPS(ubicacion){
	  
	  var miubicacion = new google.maps.LatLng(ubicacion.coords.latitude, ubicacion.coords.longitude);
	  
	  map.setCenter(miubicacion)
	  marcador.setPosition(miubicacion)
	  
  }
  
  function errorGPS(){
	  alerta(" no puedo encontrarte :(")
  }
  function mostrarTrafico(){
	  var trafficLayer = new google.maps.TrafficLayer();
	  trafficLayer.setMap(map);
  }
  google.maps.event.addDomListener(window, 'load', initialize);
  
  
    </script>
  </head>
  <body onload="initialize()">
    <div id="map_canvas" style="width:100%; height:90%"></div>
   <button onClick="mostrarUbicacion()"> mostrar mi ubicacion </button>
   <button onClick="mostrarTrafico()"> mostrar trafico </button>
  </body>
</html>